fuzz: improve code coverage (#273)
authortyler92 <tyler92@inbox.ru>
Sat, 28 Dec 2024 18:27:15 +0000 (20:27 +0200)
committerGitHub <noreply@github.com>
Sat, 28 Dec 2024 18:27:15 +0000 (13:27 -0500)
test/fuzzer.c

index b5349a322c9f01c487389607688a7f704373bd12..98ce4906b5243b76880a895bedb5a4d55c2f8b0a 100644 (file)
@@ -14,6 +14,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
     utf8proc_int32_t c = 0, c_prev = 0, state = 0;
     utf8proc_option_t options;
     utf8proc_ssize_t ret, bytes = 0;
+    utf8proc_uint8_t *str = NULL;
     size_t len = strlen((const char*)data);
     
     while(bytes != len)
@@ -80,5 +81,14 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
     free(utf8proc_NFKC(data));
     free(utf8proc_NFKC_Casefold(data));
 
+    utf8proc_map(data, len, &str, UTF8PROC_CHARBOUND | UTF8PROC_STRIPNA);
+    free(str);
+
+    utf8proc_map(data, len, &str, UTF8PROC_LUMP | UTF8PROC_NLF2LS | UTF8PROC_NLF2PS);
+    free(str);
+
+    utf8proc_map(data, len, &str, UTF8PROC_COMPOSE | UTF8PROC_STRIPMARK);
+    free(str);
+
     return 0;
 }
\ No newline at end of file